package com.nc.delivery_project.server.domain;

public class Cargo {

    private int id;
    private int orderId;
    private String title;

    private int cost;

    private Currency currency;

    private int weight;
    private int height;
    private int width;
    private int depth;

    public Cargo (){}

    public Cargo(int id,String title, int cost, int weight, int height, int width, int depth, Currency currency)
    {
        this(id,title, weight, height, width, depth);
        this.cost=cost;
        this.currency=currency;

    }
    public Cargo (int id, String title, int weight, int height, int width, int depth)
    {
        this.id=id;
        this.title=title;
        this.weight=weight;
        this.width=width;
        this.height=height;
        this.depth=depth;
    }

    public int getId() {
        return id;
    }
    public int getOrderId()
    {return orderId;}

    public void setOrderId(int orderId)
    {
        this.orderId=orderId;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getCost() {
        return cost;
    }

    public void setCost(int cost) {
        this.cost = cost;
    }

    public Currency getCurrency() {
        return currency;
    }

    public void setCurrency(Currency currency) {
        this.currency = currency;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getDepth() {
        return depth;
    }

    public void setDepth(int depth) {
        this.depth = depth;
    }
/*
title; cost; currency; weight; height; width; depth;
 */
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Cargo)) return false;

        Cargo cargo = (Cargo) o;

        if (title != null ? !title.equals(cargo.title) : cargo.title != null) return false;
        if (cost != cargo.cost) return false;
        if (currency!=cargo.currency) return false;
        if (weight!=cargo.weight) return false;
        if (height!=cargo.height) return false;
        if (width!=cargo.width) return false;
        if (depth!=cargo.depth) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + ((Integer)cost != null ? ((Integer)cost).hashCode() : 0);
       // result = 31 * result + ((Integer)currency != null ? ((Integer)currency).hashCode() : 0);
        result = 31 * result + ((Integer)weight != null ? ((Integer)weight).hashCode() : 0);
        result = 31 * result + ((Integer)height != null ? ((Integer)height).hashCode() : 0);
        result = 31 * result + ((Integer)width != null ? ((Integer)width).hashCode() : 0);
        result = 31 * result + ((Integer)depth != null ? ((Integer)depth).hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Cargo{");
        sb.append("id=").append(id);
        sb.append(", title='").append(title).append('\'');
        sb.append(", cost='").append(cost).append('\'');
        sb.append(", currency=").append(currency);
        sb.append(", weight=").append(weight);
        sb.append(", height=").append(height);
        sb.append(", width=").append(width);
        sb.append(", depth=").append(depth);
        sb.append('}');
        return sb.toString();
    }
}
